<?php
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
use app\modules\admin\models\UserModel;

/**
 * 文本框:textInput();
 * 密码框:passwordInput();
 * 单选框:radio(),radioList();
 * 复选框:checkbox(),checkboxList();
 * 下拉框:dropDownList();
 * 隐藏域:hiddenInput();
 * 文本域:textarea(['rows'=>3]);
 * 文件上传:fileInput();
 * 提交按钮:submitButton();
 * 重置按钮:resetButtun(); 
 */

?>
<div class="admin-default-index">
    <p><?= $this->context->action->uniqueId ?></p>
    <p>
        "<?= $this->context->action->id ?>".
        "<?= get_class($this->context) ?>"
        "<?= $this->context->module->id ?>"
    </p>
    <p>
        <small><?= __FILE__ ?></small>
    </p>
    
</div>
<?php
    $form = ActiveForm::begin(['method' => 'post', 'id' => 'myform',
    'fieldConfig' => [
        'template' => '<div class="col-xs-3 text-left">{label}</div><div class="col-xs-9">{input}</div><p>{error}</p>',
        // 'enableClientValidation' => true,
    ]]);

    $model = new UserModel();

    echo $form->field($model, 'username')->textInput(['maxlength' => 20]);

    echo $form->field($model, 'password')->passwordInput(['maxlength' => 20]);

    echo $form->field($model, 'sex')->radioList(['1' => '男', '0' => '女']);

    echo '<div class="col-xs-5"></div><div class="col-xs-2">';
    echo Html::submitButton('submit');
    echo '</div><div class="col-xs-5></div>"';

    ActiveForm::end();
?>
</div>
</div>
